import {BT_TYPE, QUESTION_STATE} from "@/constantData";
import {HANDEL_CODE_CONFIG} from "@/views/securityCheck/ztDefectInspect/components/eventConfig";
import {INFO_PAGE_NAME} from "@/views/securityCheck/defectQuestion/infoPage/confo";


const SHOW_PAGE_FUN = {
  [INFO_PAGE_NAME.HiddenDangerShowPage]: {
    HANDEL_BT: [
      {
        type: BT_TYPE.primary,
        icon: "el-icon-search",
        size: "mini",
        label: '编辑',
        fun: 'handleAdd',
        baseParam: null,
        filterFun: ({inspectInfo, handelCode, infoData}) => {
          return handelCode == HANDEL_CODE_CONFIG.ADD_HIDDEN_DANGER && (infoData || {}).questionState == QUESTION_STATE.draft
        }
      },
      {
        type: BT_TYPE.success,
        icon: "el-icon-refresh",
        size: "mini",
        label: '提交',
        fun: 'submit',
        baseParam: null,
        filterFun: ({inspectInfo, handelCode, infoData}) => {
          return handelCode == HANDEL_CODE_CONFIG.ADD_HIDDEN_DANGER && (infoData || {}).questionState == QUESTION_STATE.draft
        }
      },
      {
        type: BT_TYPE.warning,
        icon: "el-icon-refresh",
        size: "mini",
        label: '撤回',
        fun: 'handleRevoke',
        baseParam: null,
        filterFun: ({inspectInfo, handelCode, infoData}) => {
          return handelCode == HANDEL_CODE_CONFIG.ADD_HIDDEN_DANGER && (infoData || {}).questionState == QUESTION_STATE.official
        }
      },
      {
        type: '',
        icon: "el-icon-refresh",
        size: "mini",
        label: '导出数据',
        fun: 'handleRevoke',
        baseParam: null,
        filterFun: ({inspectInfo, handelCode, infoData}) => {
          return handelCode == HANDEL_CODE_CONFIG.ADD_HIDDEN_DANGER
        }
      },
      {
        type: BT_TYPE.success,
        icon: "el-icon-refresh",
        size: "mini",
        label: '通过',
        fun: 'audit',
        baseParam: {result: 'Y'},
        filterFun: ({inspectInfo, handelCode, infoData}) => {
          return handelCode == HANDEL_CODE_CONFIG.REVIEW_DATA
        }
      },
      {
        type: BT_TYPE.warning,
        icon: "el-icon-refresh",
        size: "mini",
        label: '退回',
        fun: 'audit',
        baseParam: {result: 'N'},
        filterFun: ({inspectInfo, handelCode, infoData}) => {
          return handelCode == HANDEL_CODE_CONFIG.REVIEW_DATA
        }
      },
    ],
  }
}

export {SHOW_PAGE_FUN}
